package de.placidi.pressreview;

import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
import java.util.List;

import de.placidi.pressreview.exceptions.LinkNotReachableException;
import de.placidi.pressreview.parsing.HTMLParser;
import de.placidi.pressreview.parsing.HTMLParserImpl;

/*
 * Testen der Linksammlung
 */
public class ScannerMain {

	public static void main(String[] args) throws LinkNotReachableException, IOException {
		
		HTMLParser parser = new HTMLParserImpl(true, "10.101.21.1", "8877");
		List<String> texts = parser.getAllTexts("http://www.bbc.co.uk/", "http://www.bbc.co.uk/news", 2);
		
		writeFile(texts);

	}
	
	
	public static void writeFile(List<String> lines) throws IOException {
		 BufferedWriter out = new BufferedWriter(new FileWriter("headlines.txt", true));
         
		 for (String line : lines) {
			out.write(line+"\n");
		 }
		 
         out.close();
	}

}
